/**
 * Project: apollo-base-tools
 * 
 * File Created at 2017年8月7日
 * 
 * Copyright 2015-2016 dx.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DongXue software Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dx.com.
 */
package org.apollo.sys;

import java.net.MalformedURLException;
import java.net.URL;

/** 
* @ClassName: ResouceLoader 
* @Description: 资源加载
* @author wuzhenfang(wzfbj2008@163.com)
* @date 2017年8月7日 下午3:56:15 
* @version V1.0 
*/
public class ResouceLoader {
	
	public static URL getFileURL(String url_name) {
		try {
			return new URL(Constants.PROTOCOL_FILE + url_name);
		} catch (MalformedURLException e) {
			e.printStackTrace();
			throw new RuntimeException("Malformed URL " + url_name, e);
		}
	}

	public static String getFilePath(String filePath) {
		return getFileURL(filePath).getPath();
	}

	/**
	 * @param url_name
	 * @return url
	 */
	public static URL getResouce(String url_name) {
		return ClassLoader.getSystemResource(url_name);
	}
}
